(function () {
    var cate = utils.getParams(1);

    var newsCateName = {
        news: '资讯',
        gonglve: '攻略',
        shipin: '视频',
        pingce: '评测'
    };

    //必须使用data.attr
    var template =
        `{% if( data.id ){ %}
            <div class="game news-list-item">      
                <div class="game-content">
                    <div class="game-title" style="display: block">
                        <h3 style="margin-bottom: 10px">
                            <a class="ellipse" href="/topic/{% data.id %}" target="_blank">
                                {% data.title %}
                            </a>
                        </h3>
                        <div class="common-info-desc">
                             <span class="iconfont icon-shijian"></span>
                             {% data.push_time %}
                        </div>
                    </div>
                </div>   
                <a href="/topic/{% data.id %}" target="_blank" class="${cate === 'shipin' ? 'pic pic-poster' : 'pic' }">
                    ${cate === 'shipin' ? ` <span class="iconfont icon-video-tint"></span>` : ''}
                    <img data-original="{% data.img %}">
                </a> 
                
                {% if(data.intro){ %}
                    <p class="game-intro">{% data.intro %}</p>
                {% } %}   
            </div>
        {% }else{ %}
            <div class="tg game">
                <div class="game-content">
                    <h3 class="tg-title"><span>推广</span>{% data.title %}</h3>
                </div>
                <a class="pic" href="{% data.url %}" target="_blank">
                    <img data-original="{% data.img %}" alt="{% data.title %}">
                </a>
            </div>
        {% } %}`;


    //创建点击加载更多功能
    var loadNewsList = new LoadData({
        btn: '#getMoreBtn',
        lists: '#newsList',
        listType: 'info',
        url: '/article/ajax_info_list/' + cate,
        page: 2,
        template: template,
        method: 'append',
        loadingAnim: true,
        loadingAnimDom: '.loading-container',
        handleFn: {
            'push_time': utils.getLocalTime.bind(utils)
        },
        afterRender: function () {
            $("img").lazyload({
                effect: "fadeIn",
                effectspeed: 1500
            });
        }
    });

})();

